﻿namespace IceDog.DNL.CSharp.DesignPattern.AbstractFactoryPattern.WorldThings
{
    /// <summary>
    /// 颜色类型
    /// </summary>
    public enum ColorType
    {
        Red,
        Yellow,
        Blue,
        Green
    }

    /// <summary>
    /// 颜色工厂
    /// </summary>
    public class ColorFactory: WorldThingsFactory
    {
        public override IShapeAction GetShape(ShapeType type)
        {
            return null;
        }

        public override IColorAction GetColor(ColorType type)
        {
            switch (type)
            {
                case ColorType.Red:
                    return new Red();
                case ColorType.Yellow:
                    return new Yellow();
                case ColorType.Blue:
                    return new Blue();
                case ColorType.Green:
                    return new Green();
                default:
                    return null;
            }
        }
    }
}

